/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package view;

import java.awt.Dimension;
import java.awt.Frame;
import java.awt.Toolkit;
import java.beans.PropertyVetoException;
import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JDesktopPane;
import javax.swing.JInternalFrame;
import javax.swing.JOptionPane;
import javax.swing.plaf.basic.BasicInternalFrameUI;

/**
 *
 * @author brunorafael
 */
public class TesteInternal extends javax.swing.JInternalFrame {

    /**
     * Creates new form NewJInternalFrame
     */
    public TesteInternal() {
        try {
            this.moveToFront();
            this.setVisible(true);

            initComponents();
            escolheLabel();
            //Tira as barras de todos os lados da janela
            ((BasicInternalFrameUI) this.getUI()).setNorthPane(null);
            ((BasicInternalFrameUI) this.getUI()).setSouthPane(null);
            ((BasicInternalFrameUI) this.getUI()).setWestPane(null);
            ((BasicInternalFrameUI) this.getUI()).setEastPane(null);

            //this.add
        } catch (Exception ex) {
            Logger.getLogger(TesteInternal.class.getName()).log(Level.SEVERE, null, ex);
        }

        //jpPrincipal.set
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLayeredPane1 = new javax.swing.JLayeredPane();
        jPanel1 = new javax.swing.JPanel();
        jP1024 = new javax.swing.JPanel();
        jLabel4 = new javax.swing.JLabel();
        jP1280 = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        jP1440 = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jP1900 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();

        javax.swing.GroupLayout jLayeredPane1Layout = new javax.swing.GroupLayout(jLayeredPane1);
        jLayeredPane1.setLayout(jLayeredPane1Layout);
        jLayeredPane1Layout.setHorizontalGroup(
            jLayeredPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 100, Short.MAX_VALUE)
        );
        jLayeredPane1Layout.setVerticalGroup(
            jLayeredPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 100, Short.MAX_VALUE)
        );

        setBorder(null);
        setAlignmentX(0.0F);
        setAlignmentY(0.0F);
        setOpaque(true);
        addComponentListener(new java.awt.event.ComponentAdapter() {
            public void componentMoved(java.awt.event.ComponentEvent evt) {
                formComponentMoved(evt);
            }
        });
        getContentPane().setLayout(new java.awt.GridLayout(1, 0));

        jPanel1.setAlignmentX(0.0F);
        jPanel1.setAlignmentY(0.0F);
        jPanel1.setNextFocusableComponent(this);
        jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jLabel4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/tela.1024.768.2_1.jpg"))); // NOI18N

        javax.swing.GroupLayout jP1024Layout = new javax.swing.GroupLayout(jP1024);
        jP1024.setLayout(jP1024Layout);
        jP1024Layout.setHorizontalGroup(
            jP1024Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLabel4)
        );
        jP1024Layout.setVerticalGroup(
            jP1024Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLabel4)
        );

        jPanel1.add(jP1024, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));

        jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/tela.1280.1024.4.jpg"))); // NOI18N

        javax.swing.GroupLayout jP1280Layout = new javax.swing.GroupLayout(jP1280);
        jP1280.setLayout(jP1280Layout);
        jP1280Layout.setHorizontalGroup(
            jP1280Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jP1280Layout.createSequentialGroup()
                .addComponent(jLabel3)
                .addGap(0, 1839, Short.MAX_VALUE))
        );
        jP1280Layout.setVerticalGroup(
            jP1280Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jP1280Layout.createSequentialGroup()
                .addComponent(jLabel3)
                .addGap(0, 334, Short.MAX_VALUE))
        );

        jPanel1.add(jP1280, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));

        jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/tela.1440.900.2_1.jpg"))); // NOI18N
        jLabel2.setText("jL1440.900");

        javax.swing.GroupLayout jP1440Layout = new javax.swing.GroupLayout(jP1440);
        jP1440.setLayout(jP1440Layout);
        jP1440Layout.setHorizontalGroup(
            jP1440Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 1292, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        jP1440Layout.setVerticalGroup(
            jP1440Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLabel2)
        );

        jPanel1.add(jP1440, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 1300, 750));

        jP1900.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        jP1900.setLayout(null);

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/tela.1920.1800.2_4.jpg"))); // NOI18N
        jP1900.add(jLabel1);
        jLabel1.setBounds(0, 0, 1773, 920);

        jPanel1.add(jP1900, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 1780, 950));

        getContentPane().add(jPanel1);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void formComponentMoved(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentMoved
        setLocation(0, 0);
    }//GEN-LAST:event_formComponentMoved

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLayeredPane jLayeredPane1;
    private javax.swing.JPanel jP1024;
    private javax.swing.JPanel jP1280;
    private javax.swing.JPanel jP1440;
    private javax.swing.JPanel jP1900;
    private javax.swing.JPanel jPanel1;
    // End of variables declaration//GEN-END:variables

    public void pegarResolução() {
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        Dimension scrnsize = toolkit.getScreenSize();
        // System.out.println("Tamanho : " + scrnsize);
        JOptionPane.showMessageDialog(null, scrnsize.height);
        JOptionPane.showMessageDialog(null, scrnsize.width);
    }

    private void escolheLabel() {

        //Pegar a resolução
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        Dimension scrnsize = toolkit.getScreenSize();
        int x;
        //Resultado do tamanho da resolução
        x = (scrnsize.width - scrnsize.height);

        if ((scrnsize.width == 1920) && (scrnsize.height == 1080)) {
            jP1900.setVisible(true);
            jP1440.setVisible(false);
            jP1280.setVisible(false);
            jP1024.setVisible(false);
        } else if ((scrnsize.width == 1440) && ((scrnsize.height == 900))) {
            jP1900.setVisible(false);
            jP1440.setVisible(false);
            jP1280.setVisible(true);
            jP1024.setVisible(false);
        } else if ((scrnsize.width == 1280) && ((scrnsize.height == 1024))) {
            jP1900.setVisible(false);
            jP1440.setVisible(false);
            jP1280.setVisible(true);
            jP1024.setVisible(false);
        } else if ((scrnsize.width == 1024) && ((scrnsize.height == 768))) {
            jP1900.setVisible(false);
            jP1440.setVisible(false);
            jP1280.setVisible(false);
            jP1024.setVisible(true);
        } else if ((x < 300)) {
            jP1900.setVisible(false);
            jP1440.setVisible(false);
            jP1280.setVisible(false);
            jP1024.setVisible(true);
        } else if ((x >= 300) && (x < 600)) {
            jP1900.setVisible(false);
            jP1440.setVisible(true);
            jP1280.setVisible(false);
            jP1024.setVisible(false);
        } else {
            jP1900.setVisible(true);
            jP1440.setVisible(false);
            jP1280.setVisible(false);
            jP1024.setVisible(false);
        }

    }

}
